<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>es6</title>
</head>
<body>
<script>
    // 1.let与 const
    let s=Symbol();
    console.log(typeof s)
   /* const v="hello world";
    (function () {
        alert(v);
        const v="I love you!";
    })()*/
    // 2.let与 const
    var funcs=[];
    for(var i=0;i<10;i++ ){
        funcs.push((function (value) {
            return value;
        })(i))
    }
    for(let i=0;i<10;i++){
        funcs.push(i)
    }
    console.log(funcs)
    //3.模版字符串
    var name1="kingx";
    console.log('hello'+name1);
    const name2="kingx";
    console.log(`hello ${name2}`);
    //4.数组解构
    //对象
    const people={
        name:'kingx',
        age:20
    }
    const {name,age}=people;
    console.log(`${name} -------${age}`);
    //5.张开运算符
    const number=[1,2,3,4,5];
    const [first,...rest]=number;
    console.log(rest)


   /* function foo1(){
        return {
            bar:"hello"
        };
    }
    function foo2(){
        return
        {
            bar:"hello"
        };
    }
    console.log("foo1 return:")
    console.log(foo1())
    console.log("foo2 return:")
    console.log(foo2())*/

    console.log((function f(n){return ((n > 1) ? n * f(n-1) : n)})(10));



</script>
</body>
</html>